import { Component } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd/message';

@Component({
  selector: 'app-demo-local-storage',
  templateUrl: './demo-local-storage.component.html',
  styleUrls: ['./demo-local-storage.component.less']
})
export class DemoLocalStorageComponent {
  constructor(private message: NzMessageService) { }

  msg01: any = true;
  msg02: any = false;
  xxx: any = '空数据';


  handleLocalStorage() {
    localStorage.setItem('dmeo', this.msg01); // 开启
  }

  getLocalStorage() {
    let xxx = localStorage.getItem('dmeo');
    console.log(xxx);
    this.xxx = xxx;
  }

  remoteLocalStorage() {
    localStorage.removeItem('dmeo');
  }

  clearLocalStorage() {
    localStorage.clear();
  }

  handleOpen() {
    localStorage.setItem('open', 'true'); // 开启
  }
  handleOff() {
    localStorage.setItem('open', 'false'); // 开启
  }

  loginOut() {
    let xxx = localStorage.getItem('open');
    console.log(xxx);

    if (xxx == 'true') {
      this.message.error('退出禁用')
    } else {
      this.message.success('退出成功')
    }
  }

  handledisab() {
    console.log('handledisab');

  }
}
